home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
C
/
Applications
/
MacGzip 1.0
/
source
/
Mac
/
GzPStrings.c
< prev
next >
Wrap
Text File
|
1995-08-19
|
859b
|
66 lines
/*
* SPDStrings.c
* (C) SPDsoft, August 13, 1995
*
* Some String utils
*/
#include "GzPStrings.h"
#ifndef MIN
# define MIN(a,b) (((a)<(b))?(a):(b))
#endif
void PStrCat( Str255 dest, Str255 src )
{
long sLen = MIN(*src, 255 - *dest);
BlockMove(src + 1, dest + *dest + 1, sLen);
*dest += sLen;
return;
}
void CStrToStr255( Str255 pstr, char *s )
{
register char *c;
for( c = (char *) &pstr[1], pstr[0] = 0x00;
*s != 0x00 && pstr[0] <= 255 ;
pstr[0]++
)
{
*c++ = *s++;
}
}
void Str255ToCStr( char *s, Str255 pstr )
{
register char *p, *pf;
for( p = (char *) pstr,
pf = p + pstr[0];
p < pf ;
*(s++) = *(++p)
)
;
*s = 0x00;
}
OSType Str255ToOSType( Str255 pstr )
{
OSType result='\000\000\000\000';
BlockMove(&(pstr[1]), &result, (Size) MIN(pstr[1],sizeof(OSType)));
return result;
}